<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>话题列表</title>
    <link rel="stylesheet" href="${ctxPath}/css/common.css">
    <link rel="stylesheet" href="${ctxPath}/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="${ctxPath}/css/topic.css">
    <link rel="stylesheet" href="${ctxPath}/font-awesome/css/font-awesome.min.css">
    <link rel="icon" href="/img/字体6.png">

</head>
<body>
<jsp:include page="/WEB-INF/pages/commons/header.jsp"></jsp:include>

<%--面包屑导航条--%>
<nav class="breadcrumb">
    <a class="breadcrumb-item" href="${ctxPath}/index.jsp">首页</a>
    <span class="breadcrumb-item active">话题列表</span>
    <span class="col-5">当前有${applicationScope.OnlineCount}人在线</span>
</nav>

<%--当前页面主要内容--%>
<main>
    <div class="row">

<%--        <select name="cars" class="custom-select-sm justify-content-center">--%>
<%--            <option selected value="3">3</option>--%>
<%--            <option value="5">5</option>--%>
<%--            <option value="10">10</option>--%>
<%--            <option value="20">20</option>--%>
<%--        </select>--%>
        <ul class="pagination justify-content-center col-3">
            每页显示&nbsp;&nbsp;&nbsp;&nbsp;
            <li class="page-item"><a class="page-link" href="${requestScope.path}?size=3">3</a></li>
            <li class="page-item"><a class="page-link" href="${requestScope.path}?size=5">5</a></li>
            <li class="page-item"><a class="page-link" href="${requestScope.path}?size=10">10</a></li>
            <li class="page-item"><a class="page-link" href="${requestScope.path}?size=20">20</a></li>
        </ul>

    </div>
                <div class="panel-body">
                    <div class="table-responsive">
                        <table class="table table-striped table-bordered table-hover" id="dataTables-example">
                            <thead>
                            <tr>
                                <th class="col-1">序号</th>
                                <th class="col-4">标题</th>
                                <th class="col-4">详情</th>
                                <th class="col-4">发布时间</th>
                                <th class="col-3">发布者</th>
                            </tr>
                            </thead>
                            <c:forEach items="${pagination.dataList}" var="t" varStatus="x">
                            <tbody>
                            <tr class="odd gradeX">
                                <td>${(pagination.current - 1) * pagination.size + x.count}</td>
                                <td>
                                    <a href="${ctxPath}/topic/detail?id=${t.id}">${t.title}</a>
                                </td>
                                <td class="content">${t.content}</td>
                                <td>${t.publishTime}</td>
                                <td class="nickname"><a href="${ctxPath}/customer/views?id=${t.id}">${t.author.nickname}</a></td>
                            </tr>
                            </tbody>
                            </c:forEach>
                        </table>
                    </div>
                </div>
    <div class="pagination-container row justify-content-center">

        <ul class="pagination pagination-lg justify-content-center">
            <li class="page-item ${pagination.current == 1 ? 'disabled' : ''}">
                <a class="page-link" href="${requestScope.path}?current = ${pagination.current-1}">上一页</a>
            </li>
            <c:forEach var="n" begin="1" step="1" end="${pagination.total}">
            <li class="page-item ${ pagination.current == n ? 'active' : '' }">
                <a class="page-link" href="${requestScope.path}?current=${n}">${n}</a>
            </li>
            </c:forEach>
            <li class="page-item ${ pagination.current == pagination.total ? 'disabled' : '' }">
                <a class="page-link" href="${requestScope.path}?current=${pagination.current+1}">下一页</a>
            </li>
        </ul>
    </div>
</main>

<jsp:include page="/WEB-INF/pages/commons/footer.jsp"></jsp:include>
</body>
</html>
